{extend name="public/nav"}

{block name="main"}
<div class="admin-content">
  <div class="am-cf am-padding">
    <div class="am-fl am-cf"> <strong class="am-text-primary am-text-lg">相册修改</strong>
      /
      <small>Update album</small>
    </div>
  </div>

  <hr/>

  <div class="am-g">

    <div class="am-u-sm-8 am-u-md-4 am-u-md-push-8"></div>

    <div class="am-u-sm-8 am-u-md-8 am-u-md-pull-4">
      <form class="am-form am-form-horizontal" method="post" action="{:U('album/update')}" id="conf_update" enctype="multipart/form-data">
        
      <div class="am-form-group">
        <label for="user-email" class="am-u-sm-4 am-form-label">相册名称 / Album name</label>
        <div class="am-u-sm-8">
          <input type="text" id="user-email" placeholder="相册名称 / Album name" name="aname" value="{$res.aname}"></div>
      </div>

      <div class="am-form-group">
        <label for="user-email" class="am-u-sm-4 am-form-label">状态 / Status</label>
        <div class="am-btn-group am-u-sm-8" data-am-button>
          <label class="am-btn am-btn-default am-btn-xs {$res['status']==1 ?= 'am-active'}">
            <input type="radio" name="status" id="option1" value="1" {$res['status']==1 ?= 'checked'}> 公开
          </label>
          <label class="am-btn am-btn-default am-btn-xs {$res['status']==3 ?= 'am-active'}">
            <input type="radio" name="status" id="option2" value="3" {$res['status']==3 ?= 'checked'}> 不公开
          </label>
        </div>
      </div>

      <div class="am-form-group">
        <div class="am-u-sm-8 am-u-sm-push-4">
          <input type="hidden" name="update_time" value="{:time()}">
          <input type="hidden" name='aid' value="{$res.id}">
          <input type="submit" class="am-btn am-btn-primary" value="保存修改"></div>
      </div>
    </form>
  </div>
</div>
</div>
{/block}

{block name="js"}
<script type="text/javascript">
    
    $('#conf_update').submit(function() {
        var index = layer.load(2);

        $(this).ajaxSubmit(function(data){
            layer.close(index);
            if(data == 1){
                layer.alert('保存成功！',{
                    icon:1,
                },function(){
                    location.reload();
                });
            }else{
                layer.alert(data,{
                    icon:2,
                });
            }
        })
        return false;
    })
</script>
{/block}